import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    token: '',
    uname: '',
    permission: null,
    headPhoto: '',
    routerData: null,
    menuData: null,
    dict: {},
    tags: []
  },
  getters: {},
  mutations: {
    setToken: (state, value) => state.token = value,
    setUname: (state, value) => state.uname = value,
    setRouterData: (state, value) => state.routerData = value,
    setMenuData: (state, value) => state.menuData = value,
    setHeadPhoto: (state, value) => state.headPhoto = value,
    setDict: (state, value) => state.dict = value,
    setTags: (state, value) => state.tags = value,
    setPermission: (state, value) => state.permission = value
  },
  actions: {
    setToken: (context, value) => context.commit("setToken", value),
    setUname: (context, value) => context.commit("setUname", value),
    setRouterData: (context, value) => context.commit("setRouterData", value),
    setMenuData: (context, value) => context.commit("setMenuData", value),
    setHeadPhoto: (context, value) => context.commit("setHeadPhoto", value),
    setDict: (context, value) => context.commit("setDict", value),
    setTags: (context, value) => context.commit("setTags", value),
    setPermission: (context, value) => context.commit("setPermission", value)
  },
  modules: {
  }
})
